import request from '@/utils/request';

import type { LoginVo, MemberForm } from '@/api/user/member/types';

/**
 * 会员注册
 * @param data
 */
const baseUrl = '/api/user';
export const registerApi = (data: MemberForm) => {
  return request({
    url: baseUrl + '/register',
    method: 'post',
    data: data
  });
};
/**
 * 会员注册
 * @param data
 */
export const loginApi = (data: LoginVo) => {
  return request({
    url: baseUrl + '/login',
    method: 'post',
    data: data
  });
};
/**
 * 会员信息
 */
export const getUserInfoApi = (id: string | number) => {
  return request({
    url: baseUrl + `/info/${id}`,
    method: 'get'
  });
};
/**
 * 退出登录
 */
export const logoutApi = () => {
  return request({
    url: baseUrl + `/logout`,
    method: 'post'
  });
};
